﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:gd="clr-namespace:WickedFlame.GenDock">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/VecDraw.GenDock;component/Resources/Brushes.xaml"/>
        <ResourceDictionary Source="/VecDraw.GenDock;component/Resources/Common.xaml"/>
    </ResourceDictionary.MergedDictionaries>


    <!--DockableContentTabItemStyle-->
    <Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type gd:ContentDocument}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gd:ContentDocument}">
                    <Grid SnapsToDevicePixels="True">
                        <Border 
						    x:Name="PART_DragArea" 
						    BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" 
						    BorderThickness="1,0,1,1" 
                            Margin="0,2,0,0"
                            CornerRadius="0,0,3,3"
                            Background="{StaticResource ManagedContentTabItemNormalBackground}"                             
                            >
                            <Border x:Name="tabItemIntBorder" 
							Margin="0,1,0,2" 
							BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}">
                                <Grid Margin="4,0,4,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    
                                    <gd:AlignedImage>
                                        <ContentPresenter x:Name="Icon"
													Grid.Column="0"
													Margin="1"
													VerticalAlignment="Center"
													ContentSource="Icon"
													SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                    </gd:AlignedImage>
                                    
                                    <TextBlock 
											x:Name="tabItemTitle"
											Grid.Column="1"
											TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
											Text="{TemplateBinding Title}" 
											Margin="2,0,0,0" VerticalAlignment="Center"
											Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                                </Grid>
                            </Border>
                        </Border>
                        <Border x:Name="HighlightBorder"
                                        Height="3"
                                        VerticalAlignment="Bottom"
                                        BorderThickness="0,0,0,0"
                                        CornerRadius ="0,0,3,3"
                                        BorderBrush="#FFE68B2C"
                                        Background="{StaticResource ManagedContentTabItemSelectedBorderBackround}"
                                        Visibility="Hidden"
                                        />
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected"
								 Value="true">
                            <Setter Property="BorderThickness"
									Value="0" TargetName="tabItemIntBorder"/>
                            <Setter Property="BorderThickness"
									Value="1,0,1,0" TargetName="PART_DragArea"/>
                            <Setter Property="Background"
									Value="#FFFCFCFE" TargetName="PART_DragArea"/>
                            <Setter Property="CornerRadius"
									Value="0,0,3,3" TargetName="PART_DragArea"/>
                            <Setter Property="Visibility"
									Value="Visible" TargetName="HighlightBorder"/>
                            <Setter Property="Foreground"
									Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TargetName="tabItemTitle"/>
                            <Setter Property="Margin"
                                    Value="0,3,0,2" TargetName="tabItemIntBorder"/>
                            <Setter Property="Margin"
                                    Value="0,1,0,0" TargetName="PART_DragArea"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
								 Value="true">
                            <Setter Property="Visibility"
									Value="Visible" TargetName="HighlightBorder"/>
                        </Trigger>
                        <Trigger Property="Icon"
                            Value="{x:Null}">
                            <Setter TargetName="Icon"
                            Property="Visibility"
                            Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <!--DockablePanel-->
    <Style TargetType="{x:Type gd:DockablePanel}">
        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.DefaultBackgroundBrush}}}"/>
        <!--<Setter Property="Background" Value="#FFFFFFFF"/>-->
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type gd:DockablePanel}">
                    <Border  
                        Focusable="False"
                        Background="{TemplateBinding Background}"><!--Focusable="True"-->
                        <Grid FocusManager.FocusedElement="{Binding ElementName=PART_SelectedContent}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <!---->
                            <Border x:Name="PART_Header" 
							    Grid.Row="0" Focusable="False" 
							    Background="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.DockablePaneTitleBackground}}}"
							    BorderThickness="1,1,1,0" 
							    BorderBrush="DarkGray"
                                Height="18">
                                <DockPanel LastChildFill="True">
                                    <Button DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="gd:DockablePanel.CloseCommand" >
                                        <Image Source="Images\PinClose.png" Width="13" Height="13" Stretch="None"/>
                                    </Button>
                                    <Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="gd:DockablePanel.ToggleAutoHideCommand" >
                                        <Image Source="Images\PinAutoHide.png" Width="13" Height="13" Stretch="None"/>
                                    </Button>
                                    <TextBlock 
									    
									    x:Name="paneTitle"
									    Grid.Row="0" 
									    Margin="2,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
                                        VerticalAlignment="Center"
									    Foreground="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.DockablePaneTitleForeground}}}"/>
                                </DockPanel>
                            </Border>
                             <Border Grid.Row="1" 
							    BorderThickness="1,0,1,1" 
							    BorderBrush="DarkGray"
                                Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}">
                                <ContentPresenter 
                                    x:Name="PART_SelectedContent"
                                    Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}"
								    KeyboardNavigation.TabNavigation="Local"
								    KeyboardNavigation.DirectionalNavigation="Contained"
								    KeyboardNavigation.TabIndex="1"
                                    />
                            </Border>
                            <Border x:Name="PART_Tabs"
                                    Grid.Row="2" 
								    Margin ="0,2,0,0" 
                                    Height ="15" 
								    BorderThickness="0,1,0,1" 
								    BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" 
								    >
                            </Border>
                        </Grid>
                    </Border>
                    
                    <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.IsActiveContent}" Value="True" >
                                <!--<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.DockablePaneTitleBackgroundSelected}}}" TargetName="PART_Header"/>-->
                                <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey {x:Type gd:DockingLayoutManager}, {x:Static gd:GenDockBrushes.DockablePaneTitleForegroundSelected}}}" TargetName="paneTitle"/>
                            </DataTrigger>
                            <Trigger Property ="ShowHeader" Value="False">
                                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Header"/>
                            </Trigger>
                        
                            <!--<Trigger Property ="ShowTabs" Value="False">
                                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/>
                            </Trigger>-->
                            <!--<Trigger Property ="HasSingleItem" Value="True">
                                <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/>
                                <Setter Property="Visibility" Value="Collapsed" TargetName="paneTabsPanel"/>
                            </Trigger>-->

                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},  Path=SelectedItem.State}" Value="AutoHide">
                                <Setter Property="LayoutTransform" TargetName="btnPinAutoHide">
                                    <Setter.Value>
                                        <RotateTransform Angle="90"/>
                                    </Setter.Value>
                                </Setter>
                            </DataTrigger>


                            </ControlTemplate.Triggers>

                </ControlTemplate>
                </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>